Linear Expected Time of a Simple Union-Find Algorithm
نویسندگان
چکیده
This paper presents an analysis of a simple tree-structured disjoint set Union-Find algorithm, and shows that this algorithm requires between n and 2n steps on the average to execute a sequence of n Union and Find instructions, assuming that each pair of existing classes is equally likely to be merged by a Union instruction. Union-Find algorithms are useful in the solution to a number of problems which require the construction of equivalence classes of a set of elements. The common parts of algorithms for constructing spanning trees of graphs, processing EQUIVALENCE statements, and determining the equivalence of finite automata are es sentially the operations of combining two equivalence classes into one new equivalence class, and of finding the equivalence class to which an element belongs. A number of algorithms for executing Union-Find instructions on a RAM are presented in ref. [1]. The fastest of these use tree structures by representing each equivalence class by a tree whose vertices represent the elements of the equivalence class. The simplest such tree-structured algorithm, which is the subject of the following analysis, executes the instruction Union (A, B) by making the root of the tree representing the equiv alence class B a son of the root of the tree representing equivalence class A. The instruction Find (x) is executed by tracing up the tree from the vertex representing x un ' til the root of the tree representing the class containing x is reached, and then returning the name of the equiva lence class stored there. This algorithm requires at worst * e(s 2) steps to execute s instructions on s elements [I], and may in fact require this many, since a chain of length e(s) can be created with s/2 union instructions, and s/2 subsequent finds can cost e(s) each. Two improvements to this algorithm are " weighted unions " , which make the root of the tree representing the smaller of the two classes being merged a son of the root of the larger, and " collapsing finds " , which make the vertices encountered on the way up to the root sons of the root. Either of these two improvements reduces the worst-case running time to e[s in(s)] steps forsin structions on s elements [1], and Tarjan [3] has shown that using both improvements produces a e(s. a(s)) run-fling time where a(s) is related to a functional inverse of Ackermann's function. …
منابع مشابه
Deriving Quasi-Linear-Time Algorithms from Union-Find in CHR Extended Abstract
The union-find algorithm can be seen as solving simple equations between variables or constants. With a few lines of code change, we generalise its implementation in CHR from equality to arbitrary binary relations. By choosing the appropriate relations, we can derive fast algorithms for solving certain propositional logic (SAT) problems as well as certain polynomial equations in two variables. ...
متن کاملA New Multi-objective Model for Multi-mode Project Planning with Risk
The purpose of this problem is to choose a set of project activities for crashing, in a way that the expected project time, cost and risk are minimized and the expected quality is maximized. In this problem, each project activity can be performed with a specific executive mode. Each executive mode is characterized with four measures, namely the expected time, cost, quality and risk. In this pap...
متن کاملAN ALGORITHM FOR FINDING THE STABILITY OF LINEAR TIME-INVARIANT SYSTEMS
The purpose of this paper is to show that the ideas and techniques of the classical methods of finding stability, such as the criteria of Leonhard and Nyquist, can be used to derive simple algorithm to verify stability. This is enhanced by evaluating the argument of the characteristic equation of a linear system in the neighbourhood of the origin of the complex plane along the imaginary axis
متن کاملThe Union-Find Problem Is Linear
The union-find problem, also known as the disjoint set union problem, involves two operations, union and find, on a collection of disjoint sets. The worst case time complexity of a sequence of n such operations was known to be near linear. We prove that its worst case time complexity is linear. The new proof technique is based on amortized complexity analysis and transformation. Our proof is su...
متن کاملQuasi-Linear-Time Algorithms by Generalisation of Union-Find in CHR
The union-find algorithm can be seen as solving simple equations between variables or constants. With a few lines of code change, we generalise its implementation in CHR from equality to arbitrary binary relations. By choosing the appropriate relations, we can derive fast incremental algorithms for solving certain propositional logic (SAT) problems and polynomial equations in two variables. In ...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
- Inf. Process. Lett.
دوره 5 شماره
صفحات -
تاریخ انتشار 1976